package com.ceshi.vo.convert;

import com.ceshi.entity.UseCaseTaskList;
import com.ceshi.vo.UseCaseTaskListDot;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 测试任务对象装换器.
 *
 * @author odin
 * @date 2020/9/24 10:37
 */
public class UseCaseTaskListConvert {


    /**
     * model转换VO.
     *
     * @param useCaseTaskList
     * @return UseCaseTaskListDot
     */
    public static UseCaseTaskListDot modelUseCaseTaskListDot(UseCaseTaskList useCaseTaskList) {
        UseCaseTaskListDot useCaseTaskListDot = new UseCaseTaskListDot();
        if (Objects.nonNull(useCaseTaskList)) {
            useCaseTaskListDot.setId(useCaseTaskList.getId());
            useCaseTaskListDot.setUserId(useCaseTaskList.getUserId());
            useCaseTaskListDot.setGitAddress(useCaseTaskList.getGitAddress());
            useCaseTaskListDot.setJobName(useCaseTaskList.getJobName());
            useCaseTaskListDot.setScopeOfExecution(useCaseTaskList.getScopeOfExecution());
            useCaseTaskListDot.setFounder(useCaseTaskList.getFounder());
            useCaseTaskListDot.setTimedTasks(useCaseTaskList.getTimedTasks());
            useCaseTaskListDot.setMessagePushAddress(useCaseTaskList.getMessagePushAddress());
            useCaseTaskListDot.setCreationTime(useCaseTaskList.getCreationTime());
            useCaseTaskListDot.setModificationTime(useCaseTaskList.getModificationTime());
            useCaseTaskListDot.setDelete(useCaseTaskList.getDelete());
        }
        return useCaseTaskListDot;
    }






    /**
     * models转换VOs.
     *
     * @param useCaseTaskLists
     * @return List<UseCaseTaskListDot>
     */
    public static List<UseCaseTaskListDot> modelsToVOs(List<UseCaseTaskList> useCaseTaskLists) {
        List<UseCaseTaskListDot> list = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(useCaseTaskLists)) {
            for (UseCaseTaskList useCaseTaskList : useCaseTaskLists) {
                list.add(modelUseCaseTaskListDot(useCaseTaskList));
            }
        }
        return list;
    }
}
